//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.

package org.ryzom.nel.misc;

public class CConfigFile {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CConfigFile(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CConfigFile obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CConfigFile(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CConfigFile() {
    this(nelmiscJNI.new_CConfigFile(), true);
  }

  public SWIGTYPE_p_NLMISC__CConfigFile__CVar getVar(String varName) {
    return new SWIGTYPE_p_NLMISC__CConfigFile__CVar(nelmiscJNI.CConfigFile_getVar__SWIG_0(swigCPtr, this, varName), false);
  }

  public SWIGTYPE_p_NLMISC__CConfigFile__CVar getVarPtr(String varName) {
    long cPtr = nelmiscJNI.CConfigFile_getVarPtr(swigCPtr, this, varName);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CConfigFile__CVar(cPtr, false);
  }

  public long getNumVar() {
    return nelmiscJNI.CConfigFile_getNumVar(swigCPtr, this);
  }

  public SWIGTYPE_p_NLMISC__CConfigFile__CVar getVar(long varId) {
    long cPtr = nelmiscJNI.CConfigFile_getVar__SWIG_1(swigCPtr, this, varId);
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CConfigFile__CVar(cPtr, false);
  }

  public SWIGTYPE_p_NLMISC__CConfigFile__CVar insertVar(String varName, SWIGTYPE_p_NLMISC__CConfigFile__CVar varToCopy) {
    long cPtr = nelmiscJNI.CConfigFile_insertVar(swigCPtr, this, varName, SWIGTYPE_p_NLMISC__CConfigFile__CVar.getCPtr(varToCopy));
    return (cPtr == 0) ? null : new SWIGTYPE_p_NLMISC__CConfigFile__CVar(cPtr, false);
  }

  public boolean exists(String varName) {
    return nelmiscJNI.CConfigFile_exists(swigCPtr, this, varName);
  }

  public void load(String fileName, boolean lookupPaths) {
    nelmiscJNI.CConfigFile_load__SWIG_0(swigCPtr, this, fileName, lookupPaths);
  }

  public void load(String fileName) {
    nelmiscJNI.CConfigFile_load__SWIG_1(swigCPtr, this, fileName);
  }

  public void save() {
    nelmiscJNI.CConfigFile_save(swigCPtr, this);
  }

  public void clear() {
    nelmiscJNI.CConfigFile_clear(swigCPtr, this);
  }

  public void clearVars() {
    nelmiscJNI.CConfigFile_clearVars(swigCPtr, this);
  }

  public boolean loaded() {
    return nelmiscJNI.CConfigFile_loaded(swigCPtr, this);
  }

  public long getVarCount() {
    return nelmiscJNI.CConfigFile_getVarCount(swigCPtr, this);
  }

  public void reparse(boolean lookupPaths) {
    nelmiscJNI.CConfigFile_reparse__SWIG_0(swigCPtr, this, lookupPaths);
  }

  public void reparse() {
    nelmiscJNI.CConfigFile_reparse__SWIG_1(swigCPtr, this);
  }

  public void display() {
    nelmiscJNI.CConfigFile_display__SWIG_0(swigCPtr, this);
  }

  public void display(CLog log) {
    nelmiscJNI.CConfigFile_display__SWIG_1(swigCPtr, this, CLog.getCPtr(log), log);
  }

  public void setCallback(SWIGTYPE_p_f___void cb) {
    nelmiscJNI.CConfigFile_setCallback__SWIG_0(swigCPtr, this, SWIGTYPE_p_f___void.getCPtr(cb));
  }

  public void setCallback(String VarName, SWIGTYPE_p_f_r_NLMISC__CConfigFile__CVar__void cb) {
    nelmiscJNI.CConfigFile_setCallback__SWIG_1(swigCPtr, this, VarName, SWIGTYPE_p_f_r_NLMISC__CConfigFile__CVar__void.getCPtr(cb));
  }

  public void setUnknownVariables(Vector_String value) {
    nelmiscJNI.CConfigFile_UnknownVariables_set(swigCPtr, this, Vector_String.getCPtr(value), value);
  }

  public Vector_String getUnknownVariables() {
    long cPtr = nelmiscJNI.CConfigFile_UnknownVariables_get(swigCPtr, this);
    return (cPtr == 0) ? null : new Vector_String(cPtr, false);
  }

  public String getFilename() {
    return nelmiscJNI.CConfigFile_getFilename(swigCPtr, this);
  }

  public static void setTimeout(long timeout) {
    nelmiscJNI.CConfigFile_setTimeout(timeout);
  }

  public static void checkConfigFiles() {
    nelmiscJNI.CConfigFile_checkConfigFiles();
  }

}
